<?php 
include "class.phpmailer.php";  
include "class.smtp.php";  

$mail = new PHPMailer(); 
$mail->IsSMTP(); // set mailer to use SMTP 
$mail->Host = "smtp.gmail.com"; // specify main and backup server 
$mail->Port = 465; // set the port to use 
$mail->SMTPAuth = true; // turn on SMTP authentication 
$mail->SMTPSecure = 'ssl'; 
$mail->Username = "phamconsult.com@gmail.com"; // your SMTP username or your gmail username 
$mail->Password = "phamconsult123"; // your SMTP password or your gmail password 
$from = "phamconsult.com@gmail.com"; // Reply to this email 
$to = "info@dayamthuc.vn"; // Recipients email ID 
$name="Admin"; // Recipient's name 
$mail->From = $from; 
$mail->FromName = $_POST['name']; // Name to indicate where the email came from when the recepient received 
$mail->AddAddress($to,$name); 
$mail->AddReplyTo($from,"admin"); 
$mail->WordWrap = 50; // set word wrap 
$mail->IsHTML(true); // send as HTML 
$mail->Subject = $_POST['Title']; 
$mail->Body = "<h3>Chào ban quản trị website.</h3></br><b>".$_POST['FullName']."</b> đã đăng ký nhận bản tin</br></br>Email: <b>".$_POST['FullName']."</b>"; //HTML Body 
$mail->AltBody =''; //Text Body 
//$mail->SMTPDebug = 2; 
$mail->SetFrom($tmp, 'Test Mail'); 
$mail->CharSet = "UTF-8"; 
if(!$mail->Send()) 
{ 
    echo "<h1>Loi khi goi mail: " . $mail->ErrorInfo . '</h1>'; 
} 
else 
{ 
    echo "<h1>Send mail thanh cong</h1>"; 
    header("location:../capcha/thongbao.html"); 
} 
?>